<?php
/**
 * Created by 784855684@qq.com.
 * Link: https://github.com/lichtung/wshore
 * User: linzh
 * Date: 7/8/17
 * Time: 10:28 AM
 */
declare(strict_types=1);


namespace application\module\admin\addon\wechat;

/**
 * Class TemplateData 模板消息数据部分
 * @package application\module\admin\addon\wechat
 */
class TemplateData
{
    private $firstValue = '';
    private $firstColor = '';

    private $keyword1Value = '';
    private $keyword1Color = '';

    private $keyword2Value = '';
    private $keyword2Color = '';

    private $keyword3Value = '';
    private $keyword3Color = '';

    private $remarkValue = '';
    private $remarkColor = '';

    public function toArray(): array
    {
        $data = [];
        # first
        $data['first'] = [
            'value' => $this->firstValue,
        ];
        $this->firstColor and $data['first']['color'] = $this->firstColor;

        # remark
        $data['remark'] = [
            'value' => $this->remarkValue,
        ];
        $this->remarkColor and $data['remark']['color'] = $this->remarkColor;

        $cur = 0;
        while ($cur++ < 3) {
            $v = "keyword{$cur}Value";
            $c = "keyword{$cur}Color";

            if ($this->{$v}) {
                $data['keyword' . $cur] = [
                    'value' => $this->{$v},
                ];
                $this->{$c} and $data['keyword' . $cur]['color'] = $this->{$c};
            }
        }
        return $data;
    }

    /**
     * @param string $firstValue
     */
    public function setFirstValue($firstValue)
    {
        $this->firstValue = $firstValue;
    }

    /**
     * @param string $firstColor
     */
    public function setFirstColor($firstColor)
    {
        $this->firstColor = $firstColor;
    }

    /**
     * @param string $keyword1Value
     */
    public function setKeyword1Value($keyword1Value)
    {
        $this->keyword1Value = $keyword1Value;
    }

    /**
     * @param string $keyword1Color
     */
    public function setKeyword1Color($keyword1Color)
    {
        $this->keyword1Color = $keyword1Color;
    }

    /**
     * @param string $keyword2Value
     */
    public function setKeyword2Value($keyword2Value)
    {
        $this->keyword2Value = $keyword2Value;
    }

    /**
     * @param string $keyword2Color
     */
    public function setKeyword2Color($keyword2Color)
    {
        $this->keyword2Color = $keyword2Color;
    }

    /**
     * @param string $keyword3Value
     */
    public function setKeyword3Value($keyword3Value)
    {
        $this->keyword3Value = $keyword3Value;
    }

    /**
     * @param string $keyword3Color
     */
    public function setKeyword3Color($keyword3Color)
    {
        $this->keyword3Color = $keyword3Color;
    }

    /**
     * @param string $remarkValue
     */
    public function setRemarkValue($remarkValue)
    {
        $this->remarkValue = $remarkValue;
    }

    /**
     * @param string $remarkColor
     */
    public function setRemarkColor($remarkColor)
    {
        $this->remarkColor = $remarkColor;
    }


}